import useRouterParams from '@/hooks/useRouterParams'
import Taro from '@tarojs/taro'

export default function useAuthShare() {
  const { shareUrl } = useRouterParams<{ shareUrl: string }>()
  // const shareUrl = encodeURIComponent('/pages/goods-details/GoodsDetails?id=8&share_id=20')
  return {
    isShare: Boolean(shareUrl),
    toSharePage() {
      Taro.redirectTo({
        url: decodeURIComponent(shareUrl),
      })
    },
    shareUrl,
  }
}
